import { useStore } from 'vuex'
import axios from './0_http'

// 注册
export const doSignin = data => 
  axios.post('/user/signin',data)

// 修改密码
export const doChangePwd = data =>
  axios.post('/user/changepwd',data)

// 数据集操作
export const baseInfoApi = {
  get : params => axios.get('/adm/baseinfo',{params}),
  post : data => axios.post('/adm/baseinfo',data),
  del : id => axios.delete('/adm/baseinfo/'+id),
  put : data => axios.put('/adm/baseinfo',data)
}

// 登录
export const getLog = params => 
  axios.get('/adm/log',{params})

// 同步课程
export const syncCourse = data =>
  axios.post('/adm/synccourse',data)
// 同步用户
export const syncUser = data =>
  axios.post('/adm/syncuser',data)
// 同步专业
export const syncMajor = data =>
  axios.post('/adm/syncmajor',data)
// 同步成绩
export const syncGrade = data =>
  axios.post('/adm/syncgrade',data)

//#region USER-MANAGER
export const getUsers = (baseid,params) => 
  axios.get('/adm/getusers/'+baseid,params)
//#endregion


export const mock = (e) => new Promise((ok)=>{
  const LoadingMessage = ElLoading.service({
    lock: true,
    text: 'Loading',
    background: 'rgba(0, 0, 0, 0.7)',
  })
  setTimeout(()=>{
    LoadingMessage.close()
    ok(e)
  },500)
})